class DrawQueue {

  queue := []

  __New(overlay) {
    this.overlay := overlay
  }

  Update() {
    this.overlay.BeginDraw()
    this.queue.foreach(v => v(this.overlay))
    this.overlay.EndDraw()
  }

  Clean() => this.queue := []

  Register(callback) {
    this.queue.Push(callback)
    return this.queue.Length
  }

  unRegister(id) {
    this.queue.Delete(id)
  }

}